//
//  AIFInitManager.m
//  PywSdk
//
//  Created by liangyidong on 16/1/26.
//  Copyright © 2016年 zero. All rights reserved.
//

#import "AIFInitManager.h"
#import "PropertyListReformer.h"


@implementation AIFInitManager

NSString *const INIT_SDK_GAMEKEY = @"gamekey";
NSString *const INIT_TID = @"tid";
NSString *const INIT_CHANNEL_ID = @"common_sdk_channle_id";

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.child = self;
        self.paramSource = self;
        self.validate = self;
    }
    return self;
}


#pragma mark - ETAPIManager
- (NSString *)methodName{
    return URL_INIT;
}

- (ETAPIManagerRequestType)requestType{
    return ETAPIManagerRequestTypePost;
}


- (NSString *)seriviceType{
    return [PywAppInfo sharedAppInfo].seriviceType;
}


#pragma mark - ETAPIManagerParamSourceDelegate
- (NSDictionary *)paramsForApi:(ETApiBaseManager *)manager{
    NSString *tid = [PywAppInfo sharedAppInfo].tid;
    NSString *cid = [PywAppInfo sharedAppInfo].th_ch_id;
    if(cid == nil || cid.length == 0){
        cid = [PywAppInfo sharedAppInfo].appType == AppTypeFQ?@"23":
        [PywAppInfo sharedAppInfo].appType == AppTypePYW?@"21":@"24";
    }
    return @{
             INIT_SDK_GAMEKEY:[PywAppInfo sharedAppInfo].gameKey,
             INIT_TID:tid,
             INIT_CHANNEL_ID:cid
             };
}



#pragma mark - ETAPIManagerValidator验证
- (BOOL)manager:(ETApiBaseManager *)manager isCorrectWithParamsData:(NSDictionary *)data{
    return YES;
}

- (BOOL)manager:(ETApiBaseManager *)manager isCorrectWithCallBackData:(NSDictionary *)data{
    return YES;
}
@end
